package org.co.service.impl;

import org.apache.ibatis.session.SqlSession;
import org.co.mapper.StudentMapper;
import org.co.model.Student;
import org.co.utils.MybatisUtils;

import java.util.List;

public class SelectAllStudentImpl {

    /**
     *  获取 sqlSession对象
     *  sqlSession未设置自动提交
     *  如需持久化手动提交
     */
    static SqlSession sqlSession;

    static {
        sqlSession = MybatisUtils.getSqlSession();
    }

    // 1. 查询所有学生信息
    public  List<Student> getAllStudent() {

        return sqlSession.getMapper(StudentMapper.class).selectAllStudent();
    }
}
